/**
 * Copyright 2018 人人开源 http://www.renren.io
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package com.lanmaoly.web.common.exception;

import com.lanmaoly.web.common.response.CommonCode;

/**
 * 自定义异常
 *
 * @author Administrator
 */
public class ArbitrationException extends RuntimeException {
    private static final long serialVersionUID = 1L;

    private String msg;
    private int code = 500;
    private CommonCode commonCode = CommonCode.FAIL;

    public ArbitrationException(CommonCode commonCode) {
        super(commonCode.message());
        this.msg = commonCode.message();
        this.code = commonCode.code();
        this.commonCode = commonCode;
    }

    public ArbitrationException(CommonCode commonCode, Throwable e) {
        super(commonCode.message(), e);
        this.msg = commonCode.message();
        this.code = commonCode.code();
        this.commonCode = commonCode;
    }

    public ArbitrationException(String msg) {
        super(msg);
        this.msg = msg;
    }

    public ArbitrationException(String msg, Throwable e) {
        super(msg, e);
        this.msg = msg;
    }

    public ArbitrationException(String msg, int code) {
        super(msg);
        this.msg = msg;
        this.code = code;
    }

    public ArbitrationException(String msg, int code, Throwable e) {
        super(msg, e);
        this.msg = msg;
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public int getCode() {
        return code;
    }

    public CommonCode getCommonCode() {
        return commonCode;
    }

}
